set inten on
STORE 0 TO CNT,CR
play=savescreen(0,0,24,79)
sele 1
set exclu off
use &dr&f1 inde &dr&f11
seek ALLTRIM(kunci)
if .not. eof()
   DO WHILE left(drug_name,len(kunci))=alltrim(kunci)
      CNT=CNT+1
      skip
   ENDDO
ENDIF
SELE 7
set exclu off
use &dr&F7 inde &dr&F71
seek ALLTRIM(kunci)
if .not. eof()
   DO WHILE left(dISP_name,len(kunci))=alltrim(kunci)
      CNT=CNT+1
      skip
   ENDDO
endif
IF CNT=0
   RETURN
ENDIF
DECLARE FILD[CNT]
DECLARE drcod[CNT]
DECLARE CNAM[CNT]
SELE 1
seek ALLTRIM(kunci)
if .not. eof()
   DO WHILE left(drug_name,len(kunci))=alltrim(kunci)
      CR=CR+1
      nm=alltrim(drug_name)+' '+alltrim(drug_type)+' '+alltrim(drug_qant)+' '+alltrim(drug_unit)
*      FILD[CR]=subs(NM,1,45)+space(45-len(nm))+subs(generic,1,20)+'  '+drug_code
      FILD[CR]=subs(NM,1,35)+space(35-len(nm))+subs(generic,1,20)+'  '+drug_code
      drcod[CR]=drug_CODE
      CNAM[CR]=drug_NAME
      SKIP
   ENDDO
endif
SELE 7
seek ALLTRIM(kunci)
if .not. eof()
   DO WHILE left(DISP_name,len(kunci))=alltrim(kunci)
      CR=CR+1
      nm=alltrim(DISP_name)+' '+alltrim(DISP_type)+' '+alltrim(DISP_qant)+' '+alltrim(DISP_unit)
**      FILD[CR]=subs(NM,1,45)+space(45-len(nm))+SPACE(20)+'  '+DISP_code
      FILD[CR]=subs(NM,1,45)+space(45-len(nm))+SPACE(13)+'  '+DISP_code
      drcod[CR]=DISP_CODE
      CNAM[CR]=DISP_NAME
      SKIP
   ENDDO
endif
set colo to w/b
inkey()
set colo to w+/rb,gr+/r
@ 15,3 clea to 22,75
@ 15,3 to 22,75 double
pilih=achoice(16,5,21,73,FILD)
IF LASTKEY()=13
   DARF=FILD[PILIH]
   kode=drcod[PILIH]
   name=CNAM[PILIH]
else
   restscreen(0,0,24,79,play)
   return
ENDIF
*else
*   name=space(32)
*endif
return
